# 处理配置文件
import os
import json

class Config():

    configPath = '../config/'

    config = {}

    def __init__(self) -> None:
        pass

    '''导入对应配置文件'''

    def load(self, name):
        path = self.configPath + name + '.json'
        if (os.path.exists(path)) :
            openJson = open(path, 'r')
            context = json.load(openJson)
            self.config[name] = context
            pass

        pass

    def run(self):
        jsonList = os.listdir(self.configPath)
        for fileName in jsonList:
            fileSplit = fileName.split('.')
            if (fileSplit[len(fileSplit) -1] == 'json') :
                self.load(fileSplit[0])
            pass
        return self.config
        pass
       
